<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>loadStyles</title>
</head>

<body>
    <div class="test">样式文件加载完成后，字体样式将是#2396ef;</div>
    <script>
        const loadStyles = url => {
            const link = document.createElement('link');
            link.href = url;
            link.rel = 'stylesheet';
            link.type = 'text/css';
            const head = document.getElementsByTagName('head')[0];
            head.appendChild(link)
        };
        loadStyles('loadStyles.css')
    </script>
</body>

</html>